package prototype.exception;

import com.google.gson.JsonObject;
import prototype.constant.EMessageConst;
import prototype.constant.EObjectType;

/**
 *
 */
public class ObjectNotUniqueException extends AbstractExeption {
	private EObjectType objectType;
	private Integer objectAIndex;
	private Long objectAId;
	private Integer objectBIndex;
	private Long objectBId;

	public ObjectNotUniqueException(EObjectType objectType, Integer objectAIndex, Long objectAId, Integer objectBIndex, Long objectBId) {
		super(EMessageConst.OBJECT_NOT_UNIQUE.name());
		this.objectType = objectType;
		this.objectAIndex = objectAIndex;
		this.objectAId = objectAId;
		this.objectBIndex = objectBIndex;
		this.objectBId = objectBId;
	}

	@Override
	public JsonObject toJsonObject() {
		JsonObject jsonObject = super.toJsonObject();
		jsonObject.addProperty("objectType", objectType.name());
		jsonObject.addProperty("objectAIndex", objectAIndex);
		jsonObject.addProperty("objectAId", objectAId);
		jsonObject.addProperty("objectBIndex", objectBIndex);
		jsonObject.addProperty("objectBId", objectBId);
		return jsonObject;
	}
}
